#include "Button.h"
namespace Core
{
	namespace UI
	{
		Button::Button(const Position& pos,const Size& size)
			:UIBase(pos,size)
		{
			if(m_isMouseIn) state=MOUSEIN;
			else state=MOUSEOUT;
		}
		void Button::OnMouseIn(const MouseEvent& mouse)
		{
			if(this->m_isLeftDown)
				state=DOWN;
			else
				state=MOUSEIN;
		}
		void Button::OnMouseOut(const MouseEvent& mouse)
		{
			if(this->m_isLeftDown)
				state=DOWN;
			else
				state=MOUSEOUT;
		}
		void Button::OnMouseDown(const MouseEvent& mouse,const Devices::KeyboardEvent& keyboardMessage)
		{
			state=DOWN;
		}
		void Button::OnMouseUp(const MouseEvent& mouse,const Devices::KeyboardEvent& keyboardMessage)
		{
			if(this->m_isMouseIn)
				state=MOUSEIN;
			else
				state=MOUSEOUT;
		}
		Button::ButtonState Button::GetState()
		{
			return state;
		}
	}
}